<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>打开新窗口并输出内容</title>
</head>

<body>
  <input type="button" value="打开" onclick="open();">

  <script>
    function op() {
      var open = window.open();
      open.document.open();
      open.document.write("<html><head><title>NEW</title></head></html>");
      open.document.write("<body>新画面</body>");
      open.document.write("</html>");
    }
  </script>
</body>

</html>